fn test_if() {
    println!("\n----------- Test Condition --------------");

    let condition = true;
    let number = if condition { 5 } else { 6 };
    println!("number: {}", number);

    let n = 6;
    if n % 4 == 0 {
        println!("{} is divisible by 4", n);
    } else if n % 3 == 0 {
        println!("{} is divisible by 3", n);
    } else if n % 2 == 0 {
        println!("{} is divisible by 2", n);
    }   else {
        println!("{} is not divisible by 4, 3, or 2", n);
    }
}

fn test_for() {
    println!("\n-------------- Test For -----------------");
    for i in 0..5 {
        if i == 3 {
            continue;
        }
        println!("i: {}", i);
    }

    let a = [1, 2, 3, 4, 5];
    for (i, v) in a.iter().enumerate() {
        if i == 3 {
            break;
        }
        println!("i: {}, v: {}", i, v);
    }

    for _ in 0..10 {
        println!("Hello, world!");
    }
}

fn test_while() {
    let mut n = 0;

    println!("\n------------- Test While ----------------");
    while n < 5 {
        println!("n: {}", n);
        n += 1;
    }
}

fn test_loop() {
    let mut i : u32 = 0;

    println!("\n-------------- Test Loop ----------------");
    let res = loop {
        i += 1;
        println!("i: {}", i);
        if i == 10 {
            break i;
        }
    };

    println!("res: {}", res);
}

fn main() {
    test_if();
    test_for();
    test_while();
    test_loop();
}
